package postwp.controller;

import com.mongodb.BasicDBObject;
import com.mongodb.DBCollection;
import com.mongodb.DBObject;
import data.Data;
import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class DeleteServlet extends HomeServlet {
	public void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws IOException {
		String url = req.getParameter("url");
		DBCollection collection = Data.data("domaincraw");
		DBObject obj = collection.findOne(new BasicDBObject("url", url));
		if (obj != null) {
			collection.remove(obj);
			resp.sendRedirect("/list");
		}
	}
}